<?php

$__FILEPATH__ = dirname(__FILE__)."/";
require_once($__FILEPATH__."./func_common.php");
require_once($__FILEPATH__."./class_def.php");
require_once($__FILEPATH__."./conf/info.php");
require_once($__FILEPATH__."../remember.php");

header("Content-Type: text/html; charset=UTF-8");

$PageArray = array();
$mysqli = GetMysqliInstance();

// 获取新闻列表的数据
$result = $mysqli->query("select id,title,time from newslist order by time desc limit 0,8",  MYSQLI_USE_RESULT);
$PageArray["newslist"] = array();
if ($result)
{
	while($row = $result->fetch_array(MYSQLI_ASSOC))
	{
		$NewsItem = new NewsListItem();
		$NewsItem->id 		= $row["id"];
		$NewsItem->title 	= $row["title"];
		$NewsItem->time 	= $row["time"];
		$PageArray["newslist"][] = $NewsItem;
	}
	$result->close();
}


// 获取网址链接的数据
$result = $mysqli->query("select src,title from linklist order by time asc",  MYSQLI_USE_RESULT);
$PageArray["linklist"] = array();
if ($result)
{
	while($row = $result->fetch_array(MYSQLI_ASSOC))
	{
		$LinkItem = new LinkListItem();
		$LinkItem->src = $row["src"];
		$LinkItem->title = $row["title"];
		$PageArray["linklist"][] = $LinkItem;
	}

	function cmp($a, $b)
	{
		return strlen($a->title) - strlen($b->title);
	}

	usort($PageArray["linklist"], cmp);

	$result->close();
}


// 获取图片列表数据
$result = $mysqli->query("select src,title from imagelist where title='ppt' order by time desc",  MYSQLI_USE_RESULT);
$PageArray["imagelist"] = array();
if ($result)
{
	while($row = $result->fetch_array(MYSQLI_ASSOC))
	{
		$ImageItem = new ImgListItem();
		$ImageItem->src 	= $row["src"];
		$ImageItem->title 	= $row["title"];
		$PageArray["imagelist"][] = $ImageItem;
	}
	$result->close();
}


$mysqli->close();

// 获取首页新闻内容
$hot_content = GetFileContent($__FILEPATH__."admin/focus_news.htm");

if (file_exists($__FILEPATH__."admin/focus_news.htm"))
	$hot_time = GetSysTime(filemtime($__FILEPATH__."admin/focus_news.htm"));



?>
